home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MYMUD21.ZIP / MMUD21.ZIP / SOURCE / SOURCE.ZIP / NORM_DO.PAS < prev    next >
Pascal/Delphi Source File  |  1995-01-21  |  34KB  |  1,149 lines

  1. {$I COPYRGHT.INC}
  2.  
  3. (*---------------------------------------------------------------------------*
  4.  
  5.   This unit contains all the normal functions which are available in the game.
  6.  
  7.  *---------------------------------------------------------------------------*)
  8.  
  9. Unit Norm_do;
  10. Interface
  11. Uses Dos,
  12.      Header,
  13.      MyIO,
  14.      VerbList,
  15.      LowLevel,
  16.      Misc,
  17.      Multi,
  18.      BoolExpr,
  19.      BIN_DB,
  20.      Out_proc;
  21.  
  22.  
  23. (*---------------------------------------------------------------------------*
  24.    Do_Look_At gives the description of the current room OR of the object
  25.    the user is looking at:
  26.  
  27.      Look           - Current room
  28.      Look at Tree   - Description of the tree
  29.      Look at me     - Description of the user self
  30.      Look here      - Description of the current room
  31.  *---------------------------------------------------------------------------*)
  32. Function Do_Look_At(Current : ContextType; InpStr : String):Boolean;
  33.  
  34.  
  35. (*---------------------------------------------------------------------------*
  36.   Gives some inside info about object.
  37.  *---------------------------------------------------------------------------*)
  38. Procedure Do_Examine(Current : ContextType;InpStr : String);
  39.  
  40.  
  41. (*---------------------------------------------------------------------------*
  42.   Do_Inventory shows the names of all object is the Object.contents chain
  43.   which have the TYPE_THING flag set.
  44.  *---------------------------------------------------------------------------*)
  45. Procedure Do_Inventory(Current : ContextType);
  46.  
  47.  
  48. (*---------------------------------------------------------------------------*
  49.   HandledMoveFail will be set if a command is accepted as a movement, but
  50.                   evaluated false.
  51.   Can_move detects if the given InpStr contains a legal movement.
  52.   Do_move does the actual move
  53.   Do_Go_Home moves the player to his/her/its home.
  54.  *---------------------------------------------------------------------------*)
  55. Var HandledMoveFail : Boolean;
  56.     ExitNr          : Integer;
  57. Function Can_Move(Current : ContextType;InpStr : String):Boolean;
  58. Procedure Do_Move(Var Current : ContextType);
  59. Procedure Do_Go_Home(Var Current : ContextType;Talk : Boolean);
  60.  
  61. (*---------------------------------------------------------------------------*
  62.   Do_Get   moves a given object from the room to the contents-list of the
  63.            player
  64.   Do_Drop  Moves a give object from the player to the room's contents-list.
  65.  *---------------------------------------------------------------------------*)
  66. Procedure Do_Get(Current  : ContextType;
  67.                  InpStr   : String);
  68. Procedure Do_Drop(Current   : ContextType;
  69.                   InpStr    : String);
  70.  
  71.  
  72. (*---------------------------------------------------------------------------*
  73.   Do_WhosOn  show's a list of users which are loggen in.
  74.  *---------------------------------------------------------------------------*)
  75. Procedure Do_WhosOn;
  76.  
  77. (*---------------------------------------------------------------------------*
  78.   Do_Say  sends a tekst to all the other users in the same room
  79.  *---------------------------------------------------------------------------*)
  80. Procedure Do_Say(Current : ContextType;InpStr : String);
  81. Procedure Do_Whisper(Current : ContextType;InpStr : String);
  82.  
  83. (*---------------------------------------------------------------------------*
  84.   Do_Score shows the user the amound of pennies he/she/it has.
  85.  *---------------------------------------------------------------------------*)
  86. Procedure Do_Score(Current : ContextType);
  87.  
  88. (*---------------------------------------------------------------------------*
  89.   Do_Rob  tries to rob a give user from 1 penny.
  90.  *---------------------------------------------------------------------------*)
  91. Procedure Do_Rob(Current : ContextType;InpStr : String);
  92.  
  93. (*---------------------------------------------------------------------------*
  94.   Do_Give  Gives money to an other player. Use:  PLAYER=<Amount>
  95.  *---------------------------------------------------------------------------*)
  96. Procedure Do_Give(Var Current : ContextType;InpStr : String);
  97.  
  98. (*---------------------------------------------------------------------------*
  99.   Try to kill an other player.
  100.  *---------------------------------------------------------------------------*)
  101. Procedure Do_Kill(Var Current : ContextType;InpStr : String);
  102.  
  103. (*---------------------------------------------------------------------------*
  104.   Try to page a user
  105.  *---------------------------------------------------------------------------*)
  106. Procedure Do_Page(Current : ContextType; InpStr : String);
  107.  
  108. (*---------------------------------------------------------------------------*
  109.   Give long help if available.
  110.  *---------------------------------------------------------------------------*)
  111. Procedure Do_Help(InpStr : String);
  112.  
  113. (*---------------------------------------------------------------------------*
  114.   Use a object. This fires up the Macro string.
  115.  *---------------------------------------------------------------------------*)
  116. Procedure Do_Use(Current : ContextType;InpStr : String);
  117.  
  118.  
  119. Implementation
  120.  
  121. (*--------------------------------------------------------------------------*)
  122. Function Do_Look_At(Current : ContextType; InpStr : String):Boolean;
  123. Var ObjNr : Integer;
  124.     Err   : Integer;
  125. Begin
  126. If InpStr=''
  127.    Then Begin
  128.         Do_Look_At:=True;
  129.         Current.DB.ReadObj(Current.Room);
  130.         If Current.DB.IsRoom And
  131.            (Not Expression(Current.DB.ObjRec.Key,Current))
  132.            Then My_WriteLn('You see nothing special.')
  133.            Else Current.DB.Describe('You see nothing special.');
  134.         Exit;
  135.         End;
  136.  
  137. InpStr:=UpStr(InpStr);
  138. If Pos('AT ',InpStr)=1
  139.    Then Delete(InpStr,1,3);
  140.  
  141. ObjNr := Str2ObjNr(Current,InpStr);
  142. If ObjNr=Nothing
  143.    Then ObjNr:=FussyStr2ObjNr(Current,InpStr);
  144.  
  145. If (ObjNr=NOTHING)
  146.    Then Begin
  147.         My_WriteLn('You see nothing special.');
  148.         Exit;
  149.         End;
  150.  
  151. Current.DB.ReadObj(ObjNr);
  152. If Current.DB.IsRoom And
  153.    (Not Expression(Current.DB.ObjRec.Key,Current))
  154.    Then Begin
  155.         My_WriteLn('You see nothing special.');
  156.         Exit;
  157.         End;
  158.  
  159. If (Current.DB.ObjRec.Location=Current.Room) Or
  160.    (Current.DB.ObjRec.Location=Current.Player) Or
  161.    (Current.DB.ObjRec.ObjType=Exit_Type) Or
  162.    (Current.DB.LevelOk(Wizard_Level))
  163.    Then Current.DB.Describe('You see nothing special.')
  164.    Else My_WriteLn('You see nothing special.');
  165.  
  166. End;
  167.  
  168. (*--------------------------------------------------------------------------*)
  169. Procedure Do_Inventory(Current : ContextType);
  170. Begin
  171. Current.DB.ReadObj(Current.Player);
  172. List_Things(Current.DB.ObjRec.Contents,False);
  173. List_Players(Current,Current.DB.ObjRec.Contents);
  174.    { Since you can''t take players, this shows only drones.. }
  175. End;
  176.  
  177. (*--------------------------------------------------------------------------*)
  178.  
  179.  
  180. Function Can_Move(Current : ContextType;InpStr : String):Boolean;
  181. Var Dum : DataBase;
  182.     Tmp : Integer;
  183.     Ok  : Boolean;
  184. Begin
  185. Can_Move:=False;
  186.  
  187. Dum.Init;
  188. Dum.ReadObj(Current.Room);
  189. InpStr:=UpStr(InpStr);
  190.  
  191. Tmp:=Dum.ObjRec.Exits;
  192. {If Tmp=NOTHING
  193.    Then Tmp:=Dum.ObjRec.Next;}
  194.  
  195.  
  196. Ok:=False;
  197. HandledMoveFail:=False;
  198.  
  199. While (Tmp<>NOTHING) and (Not OK) Do
  200.  Begin
  201.  Dum.ReadObj(Tmp);
  202.  Ok:=CheckNameList(InpStr,Dum.ObjRec.Name);
  203.  If Ok And
  204.     Expression(Dum.ObjRec.Key,Current)
  205.     Then Begin
  206.          Can_Move:=Ok;
  207.          ExitNr:=Tmp;
  208.          Dum.Final;
  209.          Exit;
  210.          End
  211.     Else Begin
  212.          If Ok
  213.             Then Begin
  214.                  Dum.Fail('You can''t go that way.');
  215.                  TranslateTextMacros(Current.PlayerName,Current.Gender,Dum.TxtRec);
  216.                  WriteText(Dum.TxtRec);
  217.  
  218.                  Dum.OFail(Current.PlayerName+' tries to go to the '+InpStr);
  219.                  TranslateTextMacros(Current.PlayerName,Current.Gender,Dum.TxtRec);
  220.                  NotifyAllHere('',Dum.TxtRec);
  221.                  HandledMoveFail:=True;
  222.                  End
  223.             Else HandledMoveFail:=False;
  224.          End;
  225.  Tmp:=Dum.ObjRec.Next;
  226.  End;
  227. Dum.Final;
  228. End;
  229.  
  230. (*--------------------------------------------------------------------------*)
  231. Procedure Do_Move(Var Current : ContextType);
  232. Var PrevRoom : Integer;
  233.     IsAction : Boolean;
  234. Begin
  235. PrevRoom:=Current.Room;
  236. Current.Room:=ExitNr;
  237. Current.Db.ReadObj(Current.Room);
  238. IsAction:=Current.Db.ObjRec.Location=Current.Db.ObjRec.Exits;
  239.  
  240. Current.DB.Success('');
  241. TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  242. If Current.DB.TxtRec[0]<>#00
  243.    Then WriteText(Current.DB.TxtRec);
  244.  
  245. Current.DB.OSuccess('');
  246. TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  247. If Current.DB.TxtRec[0]<>#00
  248.    Then Begin
  249.         If IsAction Or (Current.DB.TxtRec[0]<>#00)
  250.            Then NotifyAllHere('',Current.DB.TxtRec)
  251.            Else NotifyAllHere(Current.PlayerName+' ',Current.DB.TxtRec);
  252.         End
  253.    Else Begin
  254.         If Not IsAction
  255.            Then SayToAllHere(Current,' has left.');
  256.         End;
  257.  
  258. Current.Room:=Current.DB.ObjRec.Location;
  259. Current.Db.ReadObj(Current.Room);
  260. MoveTo(Current.Player,Current.Room);
  261. If Not IsAction
  262.    Then HandleDrones(ExitNr,Current,PrevRoom);
  263. End;
  264.  
  265.  
  266. (*--------------------------------------------------------------------------*)
  267. Procedure Do_Go_Home(Var Current : ContextType;Talk : Boolean);
  268. Var OldRoom : Integer;
  269. Begin
  270. OldRoom:=Current.Room;
  271. Lock('Updating guest..');
  272. Current.DB.ReadObj(Current.Player);
  273. Current.Room:=Current.DB.ObjRec.Exits;
  274.  
  275. If UpStr(Current.PlayerName)<>'GUEST'
  276.    Then Begin
  277.         If Talk
  278.            Then Begin
  279.                 My_WriteLn('');
  280.                 My_WriteLn('There''s no place like home...');
  281.                 My_WriteLn('There''s no place like home...');
  282.                 My_WriteLn('There''s no place like home...');
  283.                 My_WriteLn('You wake up back home, without your possessions..');
  284.                 SayToAllHere(Current,' goes home..');
  285.                 End;
  286.         End
  287.    Else Begin
  288.         Current.DB.ObjRec.Pennies:=0;
  289.         Current.DB.updateObj(Current.Player);
  290.         End;
  291. MoveTo(Current.Player,Current.Room);
  292. HandleDrones(0,Current,OldRoom);
  293. Unlock;
  294. End;
  295.  
  296. (*--------------------------------------------------------------------------*)
  297. Procedure Do_Get(Current  : ContextType;
  298.                  InpStr   : String);
  299. Var ObjNr : Integer;
  300.     Dum   : Database;
  301. Begin
  302. If InpStr=''
  303.    Then Begin
  304.         My_WriteLn('What??');
  305.         Exit;
  306.         End;
  307.  
  308. ObjNr:=ObjectIsHere(Current,InpStr);
  309.  
  310. If ObjNr=NOTHING
  311.    Then Begin
  312.         My_WriteLn('There is no '+InpStr+' to get here!');
  313.         Exit;
  314.         End;
  315.  
  316. Lock('Taking an object');
  317. Current.DB.ReadObj(ObjNr);
  318. If (ObjNr<>NOTHING) and
  319.    (Current.DB.ObjRec.Location=Current.Player)
  320.    Then Begin
  321.         My_WriteLn('You already have '+Current.DB.Name);
  322.         Unlock;
  323.         Exit;
  324.         End;
  325.  
  326. If (ObjNr<>NOTHING) And
  327.    (Current.DB.IsExit or Current.DB.IsRoom or Current.DB.IsPlayer)
  328.    Then Begin
  329.         Current.DB.Fail('You can''t take that.');
  330.         TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  331.         WriteText(Current.DB.TxtRec);
  332.  
  333.         Current.DB.OFail(Current.PlayerName+' tries to take '+InpStr+' but fails.');
  334.         TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  335.         NotifyAllHere('',Current.DB.TxtRec);
  336.         Unlock;
  337.         Exit;
  338.         End;
  339.  
  340. If (Not Expression(Current.DB.ObjRec.Key,Current))
  341.    Then Begin
  342.         Current.DB.Fail('You can''t take that.');
  343.         TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  344.         WriteText(Current.DB.TxtRec);
  345.  
  346.         Current.DB.OFail(Current.PlayerName+' tries to take '+InpStr+' but fails.');
  347.         TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  348.         NotifyAllHere('',Current.DB.TxtRec);
  349.         Unlock;
  350.         Exit;
  351.         End;
  352.  
  353. If Current.DB.IsForSale
  354.    Then Begin
  355.         Dum.Init;
  356.         Dum.ReadObj(Current.Player);
  357.         If (Current.DB.ObjRec.Pennies>Dum.ObjRec.Pennies) and
  358.            (Current.Level<Wizard_Level)
  359.            Then Begin
  360.                 My_WriteLn('You can''t afford to buy this object!');
  361.                 Dum.Final;
  362.                 Unlock;
  363.                 Exit;
  364.                 End
  365.            Else Begin
  366.                 Dec(Dum.ObjRec.Pennies,Current.DB.ObjRec.Pennies);
  367.                 Dum.UpdateObj(Current.Player);
  368.                 My_WriteLn('You bought yourself a '+Current.DB.Name+' for only '+
  369.                              Nr2Str(Current.DB.ObjRec.Pennies)+'p.');
  370.                 SayToAllHere(Current,' bought a '+Current.DB.Name);
  371.                 End;
  372.         If Current.DB.IsChownOk
  373.            Then Current.DB.ObjRec.Owner:=Current.Player;
  374.         ResetBit(Current.DB.ObjRec.Attr_Flags,For_Sale_Flag);
  375.         Current.DB.UpdateObj(ObjNr);
  376.         Dum.Final;
  377.         End;
  378.  
  379. Current.DB.Success('You take '+InpStr);
  380. TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  381. WriteText(Current.DB.TxtRec);
  382.  
  383. Current.DB.OSuccess(Current.PlayerName+' takes the '+InpStr);
  384. TranslateTextMacros(Current.PlayerName,Current.Gender,Current.DB.TxtRec);
  385. NotifyAllHere('',Current.DB.TxtRec);
  386. MoveTo(ObjNr,Current.Player);
  387. Current.DB.ResetAll;
  388. Unlock;
  389. End;
  390.  
  391.  
  392. (*--------------------------------------------------------------------------*)
  393. Procedure Do_Drop(Current   : ContextType;
  394.                   InpStr    : String);
  395. Var ObjNr  : Integer;
  396.     Reward : Integer;
  397.     Dum    : Database;
  398. Begin
  399. If InpStr=''
  400.    Then Begin
  401.         My_WriteLn('What??');
  402.         Exit;
  403.         End;
  404.  
  405. ObjNr:=ObjectIsHere(Current,InpStr);
  406.  
  407. If ObjNr=NOTHING
  408.    Then Begin
  409.         My_WriteLn('You can''t drop '+InpStr);
  410.         Exit;
  411.         End;
  412.  
  413. Lock('Drop object');
  414. Current.DB.ReadObj(ObjNr);
  415. If (Current.DB.ObjRec.Location<>Current.Player)
  416.    Then Begin
  417.         My_WriteLn('You don''t have '+InpStr);
  418.         Unlock;
  419.         Exit;
  420.         End;
  421.  
  422. Dum.Init;
  423. Dum.ReadObj(Current.Room);
  424.  
  425. If Dum.IsTemple
  426.    Then Begin
  427.         MoveTo(ObjNr,Current.DB.ObjRec.Exits);
  428.         My_WriteLn(Current.DB.Name+' is consumed in a burst of flames!');
  429.         Reward:=0;
  430.         Dum.ReadObj(Current.Player);
  431.  
  432.         Reward:=Current.DB.ObjRec.Pennies;
  433.         If Current.DB.IsOwnedBy(Current.Player) Or
  434.            Dum.LevelOk(Wizard_level)
  435.            Then Begin
  436.                 If (Reward<1) or
  437.                    (Dum.ObjRec.Pennies>Max_PENNIES)
  438.                    Then Reward:=1
  439.                    Else Begin
  440.                         If Reward > MAX_OBJECT_ENDOWMENT
  441.                            Then Reward:=MAX_OBJECT_ENDOWMENT;
  442.                         End;
  443.                 End;
  444.  
  445.  
  446.      Inc(Dum.ObjRec.Pennies,Reward);
  447.      Dum.UpdateObj(Current.Player);
  448.      If Reward=1
  449.         Then My_WriteLn('You have been rewarded 1 penny for your donation!')
  450.         Else My_WriteLn('You have been rewarded '+Nr2Str(Reward)+' pennies for your donation.');
  451.  
  452.      Dum.Final;
  453.      Unlock;
  454.      Exit;
  455.      End;
  456.  
  457. If Dum.IsShop { dum=location }
  458.    Then Begin
  459.         If Current.DB.IsOwner(Current.Player)
  460.            Then Begin
  461.                 If Current.DB.ObjRec.Pennies>1
  462.                    Then Reward:=Current.DB.ObjRec.Pennies-1
  463.                    Else Reward:=1;
  464.                 End
  465.            Else Begin
  466.                 Reward:=10;
  467.                 If Current.DB.ObjRec.Pennies<Reward
  468.                    Then reward:=Current.DB.ObjRec.Pennies;
  469.                 Reward:=-1*Reward;
  470.                 End;
  471.  
  472.         Dum.ReadObj(Current.Player);
  473.         If Dum.ObjRec.Pennies>Max_PENNIES
  474.            Then Reward:=1;
  475.         Inc(Dum.ObjRec.Pennies,Reward);
  476.         If Dum.ObjRec.Pennies<0
  477.            Then Begin
  478.                 Reward:=Reward+Dum.ObjRec.Pennies;
  479.                 Dum.ObjRec.Pennies:=0;
  480.                 End;
  481.         If Current.DB.IsSticky
  482.            Then MoveTo(ObjNr,Current.DB.ObjRec.Exits)
  483.            Else MoveTo(ObjNr,Current.Room);
  484.  
  485. {        Dum.UpdateObj(Current.Player);}
  486.  
  487.         Current.DB.ResetAll;
  488.         Current.DB.ReadObj(ObjNr);
  489.  
  490.         With Current.DB.ObjRec Do
  491.          Begin
  492.          If Not Current.DB.IsSticky
  493.             Then SetBit(Attr_Flags,For_Sale_Flag);
  494.          If Pennies<=0
  495.             Then Pennies:=5
  496.             Else Inc(Pennies,1);
  497.          Location:=Current.Room;
  498.          Key:='';
  499. {         Owner:=0;}
  500.          ObjType:=Thing_Type;
  501.          End; {With}
  502.  
  503.         Current.DB.UpdateObj(ObjNr);
  504.         Unlock;
  505.         If Reward>0
  506.            Then My_WriteLn('You sold the '+Current.DB.Name+' for '+Nr2Str(reward)+' pennies.')
  507.            Else Begin
  508.                 My_WriteLn('Since you''re not the owner of this object you are fined');
  509.                 My_WriteLn(Nr2Str(-1*Reward)+' pennies.');
  510.                 End;
  511.         SayToAllHere(Current,' sold a '+Current.DB.Name);
  512.         Dum.Final;
  513.         Exit;
  514.         End;
  515.  
  516. { Nor temple nor shop }
  517.  
  518. If Current.DB.IsSticky
  519.    Then MoveTo(ObjNr,Current.DB.ObjRec.Exits)
  520.    Else MoveTo(ObjNr,Current.Room);
  521. My_WriteLn('You drop the '+Current.DB.Name);
  522. SayToAllHere(Current,' drops the '+Current.DB.Name);
  523. Current.DB.ResetAll;
  524. Dum.Final;
  525. Unlock;
  526. End;
  527.  
  528. (*--------------------------------------------------------------------------*)
  529. Procedure Do_WhosOn;
  530. Var Cnt  : Word;
  531.     Dum  : Database;
  532.     Page : Byte;
  533. Begin
  534. Multi.GrabUserList;
  535. Dum.Init;
  536. My_WriteLn('');
  537. My_WriteLn('Node Name                Status  Last  Note');
  538. My_WriteLn('──── ─────────────────── ─────── ───── ───────────────────────────────────');
  539. Page:=0;
  540. Cnt:=1;
  541. Repeat
  542.  If NodeList[Cnt].Player>0
  543.     Then Begin
  544.          Dum.ReadObj(NodeList[Cnt].Player);
  545.          My_Write(Nr2FStr(Cnt,4)+' '+MakeStr(Dum.Name,' ',20));
  546.          My_Write(LevelNames[Dum.ObjRec.ObjLevel]);
  547.          My_Write(' '+MakeTimeString(NodeList[Cnt].Last)+' '+NodeList[Cnt].Note);
  548.          My_WriteLn('');
  549.          If Page<20
  550.             Then Inc(Page)
  551.             Else Begin
  552.                  Page:=0;
  553.                  If My_YesNo('-- More --','Y')<>'Y'
  554.                     Then Cnt:=511;
  555.                  End;
  556.          End;
  557.  Inc(Cnt);
  558. Until (Cnt>MaxMudNodes);
  559. Dum.Final;
  560. My_WriteLn('');
  561. End;
  562.  
  563. (*--------------------------------------------------------------------------*)
  564. Procedure Do_Say(Current : ContextType;InpStr : String);
  565. Begin
  566. If InpStr[1]='"'
  567.    Then Delete(InpStr,1,1);
  568. Current.DB.ReadObj(Current.Player);
  569. SayToAllHere(Current,' says "'+InpStr+'"');
  570. My_WriteLn('You say "'+InpStr+'"');
  571. End;
  572.  
  573. Procedure Do_Whisper(Current : ContextType;InpStr : String);
  574. Var Name   : NameString;
  575.     Msg    : String;
  576.     NewMsg : String;
  577.     ObjNr  : Integer;
  578.     Count  : Byte;
  579. Begin
  580. If Not SplitCommand(InpStr,Name,Msg)
  581.    Then Begin
  582.         My_WriteLn('Use Whisper <name>=<Msg>');
  583.         Exit;
  584.         End;
  585.  
  586. If Current.Level>=Wizard_Level
  587.    Then ObjNr:=Current.DB.FindPlayer(Name)
  588.    Else ObjNr:=Str2ObjNr(Current,Name);
  589.  
  590. If ObjNr=NOTHING
  591.    Then Begin
  592.         My_WriteLn(Name+' isn''t here.');
  593.         Exit;
  594.         End;
  595.  
  596. If Not IsAlive(ObjNr)
  597.    Then Begin
  598.         My_WriteLn(Name+' isn''t playing at the moment.');
  599.         Exit;
  600.         End;
  601.  
  602. Current.DB.ReadObj(ObjNr);
  603. If Not Current.DB.IsPlayer
  604.    Then Begin
  605.         My_WriteLn(Current.DB.Name+' is not a player.');
  606.         Exit;
  607.         End;
  608.  
  609. If Current.DB.ObjRec.Location=Current.Room
  610.    Then NewMsg:=Current.PlayerName+' whispers: "'+Msg+'"'
  611.    Else NewMsg:='From out of nowhere you hear '+Current.PlayerName+' whispering:\n  "'+Msg+'"';
  612.  
  613. If ObjNr=Current.Player
  614.    Then Begin
  615.         My_WriteLn(NewMsg);
  616.         SayToAllHere(Current,' whispers to himself.');
  617.         End
  618.    Else SayPrivate(ObjNr,NewMsg);
  619.  
  620. Current.DB.ReadObj(Current.Room);
  621. If (Random(10)<7) And
  622.    (Current.DB.IsLoud)
  623.    Then Begin
  624.         For Count:=1 To (Length(Msg) Div 3) Do
  625.           Msg[Random(Length(Msg))+1]:='~';
  626.         GeneralRemarkToAllHere('You here someone wispering: '+Msg);
  627.         End;
  628. End;
  629.  
  630. (*--------------------------------------------------------------------------*)
  631. Procedure Do_Score(Current : ContextType);
  632. Begin
  633. Current.DB.ReadObj(Current.Player);
  634. My_WriteLn('Your level is: '+LevelNames[Current.DB.ObjRec.ObjLevel]);
  635. If Current.DB.ObjRec.Pennies=1
  636.    Then My_WriteLn('You have 1 penny.')
  637.    Else My_WriteLn('You have '+Nr2Str(Current.DB.ObjRec.Pennies)+' pennies.');
  638. End;
  639.  
  640. (*--------------------------------------------------------------------------*)
  641. Procedure Do_Rob(Current : ContextType;InpStr : String);
  642. Var ObjNr : Integer;
  643.     Dum   : Database;
  644. Begin
  645. InpStr:=UpStr(inpStr);
  646.  
  647. Lock('Update pennies');
  648. If InpStr='ME'
  649.    Then ObjNr:=Current.Player
  650.    Else Begin
  651.         Current.DB.ReadObj(Current.Room);
  652.         ObjNr:=FindItem(Current.DB.ObjRec.Contents,InpStr);
  653.         If (ObjNr=NOTHING)
  654.            Then Begin
  655.                 My_WriteLn('Huh?!');
  656.                 UnLock;
  657.                 Exit;
  658.                 End;
  659.         End;
  660. Dum.Init;
  661. Dum.ReadObj(ObjNr);
  662. If Not Dum.IsPlayer
  663.    Then Begin
  664.         My_WriteLn('You can only rob other players.');
  665.         Unlock;
  666.         Dum.Final;
  667.         Exit;
  668.         End;
  669.  
  670. If Current.Room<>Dum.ObjRec.Location
  671.    Then Begin
  672.         My_WriteLn(InpStr+' is not here and therefor cannot be robbed.');
  673.         Dum.Final;
  674.         Unlock;
  675.         Exit;
  676.         End;
  677.  
  678. If Dum.ObjRec.Pennies<1
  679.    Then Begin
  680.         My_WriteLn(Dum.Name+' is pennyless.');
  681.         SayToAllHere(Current,' tried to rob '+Dum.Name);
  682.         Unlock;
  683.         Dum.Final;
  684.         Exit;
  685.         End;
  686.  
  687. If Not Expression(Dum.ObjRec.Key,Current)
  688.    Then Begin
  689.         Dum.Fail(Dum.Name+' is protected agains robbers!');
  690.         TranslateTextMacros(Current.PlayerName,Current.Gender,Dum.TxtRec);
  691.         WriteText(Dum.TxtRec);
  692.  
  693.         Dum.OFail(Current.PlayerName+' tries foolishly to rob '+Dum.Name+' but fails.');
  694.         TranslateTextMacros(Current.PlayerName,Current.Gender,Dum.TxtRec);
  695.         NotifyAllHere('',Dum.TxtRec);
  696.         End
  697.    Else Begin
  698.         Dec(Dum.ObjRec.Pennies);
  699.         Dum.UpdateObj(ObjNr);
  700.  
  701.         Current.DB.ReadObj(Current.Player);
  702.         Inc(Current.DB.ObjRec.Pennies);
  703.         Current.DB.UpdateObj(Current.Player);
  704.  
  705.         ResetPlayerObj(ObjNr);
  706.         Dum.Success('You got your penny!');
  707.         WriteText(Dum.TxtRec);
  708.  
  709.         Dum.OSuccess(Current.PlayerName+' stole a penny from '+dum.Name);
  710.         NotifyAllHere('',Dum.TxtRec);
  711.         End;
  712. Unlock;
  713. Dum.Final;
  714. End;
  715.  
  716. (*--------------------------------------------------------------------------*)
  717. Procedure Do_Give(Var Current : ContextType;InpStr : String);
  718. Var Name    : NameString;
  719.     Pennies : String[20];
  720.     Money   : Integer;
  721.     ObjNr   : Integer;
  722.     Dum     : Database;
  723.  
  724. Begin
  725. InpStr:=UpStr(InpStr);
  726. If Not SplitCommand(InpStr,Name,Pennies)
  727.    Then Begin
  728.         My_WriteLn('uh?');
  729.         Exit;
  730.         End;
  731. ObjNr:=Str2ObjNr(Current,Name);
  732. If ObjNr=NOTHING
  733.    Then Begin
  734.         My_WriteLn('That player is not here.');
  735.         Exit;
  736.         End;
  737.  
  738. If ObjNr=Current.Player
  739.    Then Begin
  740.         My_WriteLn('Awsome! you murmle to yourself as you give yourself some money.');
  741.         Exit;
  742.         End;
  743.  
  744. Lock('Give money');
  745. Current.DB.ReadObj(Current.Player);
  746.  
  747. Dum.Init;
  748. Dum.ReadObj(ObjNr);
  749.  
  750. {$IfNDef MakeGod}
  751. If (Not Dum.IsPlayer) Or
  752.    (Dum.LevelOk(Wizard_Level))
  753.    Then Begin
  754.         My_WriteLn('You can only give money to other players.');
  755.         Dum.Final;
  756.         Unlock;
  757.         Exit;
  758.         End;
  759. {$EndIf}
  760.  
  761. If Dum.ObjRec.Location<>Current.Room
  762.    Then Begin
  763.         My_WriteLn(Dum.Name+' is not here.');
  764.         Dum.Final;
  765.         Unlock;
  766.         Exit;
  767.         End;
  768. If Dum.ObjRec.Pennies>MAX_PENNIES
  769.    Then Begin
  770.         My_WriteLn(Dum.Name+' doesn''t need more pennies.');
  771.         Dum.Final;
  772.         Unlock;
  773.         Exit;
  774.         End;
  775.  
  776. Money:=Str2Nr(Pennies);
  777. If Money<=0
  778.    Then Begin
  779.         My_WriteLn('You can only give pennies.');
  780.         Dum.Final;
  781.         Unlock;
  782.         Exit;
  783.         End;
  784.  
  785. If (Not Current.DB.LevelOk(Wizard_Level)) And
  786.    (Money>Current.DB.ObjRec.Pennies)
  787.    Then Begin
  788.         My_WriteLn('You can''t afford such a generosity.');
  789.         Dum.Final;
  790.         Unlock;
  791.         Exit;
  792.         End
  793.    Else Begin
  794.         If Not Current.DB.LevelOk(Wizard_Level)
  795.            Then Dec(Current.DB.ObjRec.Pennies,Money);
  796.         End;
  797.  
  798. Inc(Dum.ObjRec.Pennies,Money);
  799. Dum.UpdateObj(ObjNr);
  800. Current.DB.UpdateObj(Current.Player);
  801. Unlock;
  802. My_WriteLn('Ok, you just created '+Nr2Str(Money)+' pennies for '+Dum.Name);
  803. SayPrivate(ObjNr,Current.PlayerName+' just created '+Nr2Str(Money)+' pennies for you.');
  804. Dum.Final;
  805. End;
  806.  
  807. (*--------------------------------------------------------------------------*)
  808. Procedure Do_Kill(Var Current : ContextType;InpStr : String);
  809. Var Name    : NameString;
  810.     Pennies : String[20];
  811.     Money   : Integer;
  812.     ObjNr   : Integer;
  813.     Dum     : Database;
  814.  
  815. Begin
  816. InpStr:=UpStr(InpStr);
  817. If Not SplitCommand(InpStr,Name,Pennies)
  818.    Then Begin
  819.         Name:=InpStr;
  820.         Pennies:='10';
  821.         End;
  822. ObjNr:=Str2ObjNr(Current,Name);
  823. If ObjNr=NOTHING
  824.    Then Begin
  825.         My_WriteLn('That player is not here.');
  826.         Exit;
  827.         End;
  828.  
  829. Lock('Kill player');
  830. Current.DB.ReadObj(Current.Room);
  831. If Current.DB.IsHaven
  832.    Then Begin
  833.         My_WriteLn('Sorry, this room is save for killing.');
  834.         Dum.Final;
  835.         Unlock;
  836.         Exit;
  837.         End;
  838. Current.DB.ReadObj(Current.Player);
  839.  
  840. Dum.Init;
  841. Dum.ReadObj(ObjNr);
  842. If (Not Dum.IsPlayer) Or
  843.    (Dum.LevelOk(Wizard_Level))
  844.    Then Begin
  845.         My_WriteLn('You can only kill other players.');
  846.         Dum.Final;
  847.         Unlock;
  848.         Exit;
  849.         End;
  850.  
  851. If Dum.ObjRec.Location<>Current.Room
  852.    Then Begin
  853.         My_WriteLn(Dum.Name+' is not here.');
  854.         Dum.Final;
  855.         Unlock;
  856.         Exit;
  857.         End;
  858.  
  859. Money:=Str2Nr(Pennies);
  860. If Money<=0
  861.    Then Money:=10;
  862.  
  863. If (Not Current.DB.LevelOk(Wizard_Level)) And
  864.    (Money>Current.DB.ObjRec.Pennies)
  865.    Then Begin
  866.         My_WriteLn('You don''t have enough money.');
  867.         Dum.Final;
  868.         Unlock;
  869.         Exit;
  870.         End;
  871.  
  872. If Not Current.DB.LevelOk(Wizard_Level)
  873.    Then Dec(Current.DB.ObjRec.Pennies,Money);
  874.  
  875. Current.DB.UpdateObj(Current.Player);
  876.  
  877. If Random(100)<=Money
  878.    Then Begin
  879.         Inc(Dum.ObjRec.Pennies,50);
  880.         MoveTo(ObjNr,Dum.ObjRec.Exits);
  881.         ResetPlayerObj(ObjNr);
  882.         My_WriteLn('You killed '+Dum.Name);
  883.         SayToAllHere(Current,' killed '+Dum.Name);
  884.         End
  885.    Else Begin
  886.         My_WriteLn('You attempt fails.');
  887.         SayToAllHere(Current,' tried to kill '+Dum.Name+' but failed.');
  888.         End;
  889. Unlock;
  890. Dum.Final;
  891. End;
  892.  
  893. (*--------------------------------------------------------------------------*)
  894. Procedure Do_Page(Current : ContextType; InpStr : String);
  895. Var ObjNr    : Integer;
  896.     PlayerNr : Integer;
  897. Begin
  898. If InpStr=''
  899.    Then Exit;
  900.  
  901. ObjNr:=Current.db.FindPlayer(InpStr);
  902. If ObjNr=NOTHING
  903.    Then Begin
  904.         My_WriteLn('Euh? WHO?');
  905.         Exit;
  906.         End;
  907.  
  908. Current.DB.ReadObj(ObjNr);
  909. If Not IsAlive(ObjNr)
  910.    Then Begin
  911.         My_WriteLn(Current.DB.Name+' is not playing at this moment.');
  912.         Exit;
  913.         End;
  914.  
  915. PlayerNr:=ObjNr;
  916. Current.DB.ReadObj(ObjNr);
  917. If Not Current.DB.IsPlayer
  918.    Then Begin
  919.         My_WriteLn(Current.DB.Name+' is not a player.');
  920.         Exit;
  921.         End;
  922.  
  923. Current.DB.ReadObj(Current.DB.ObjRec.Location);
  924. If Current.DB.IsHaven
  925.    Then Begin
  926.         My_WriteLn('Player is in haven.');
  927.         Exit;
  928.         End;
  929.  
  930. Current.DB.ReadObj(Current.Room);
  931. If PlayerNr=Current.Player
  932.    Then My_WriteLn(Current.PlayerName+' pages himself from here.')
  933.    Else SayPrivate(PlayerNr,Current.PlayerName+' pages you from '+Current.Db.Name);
  934. My_WriteLn('Player paged.');
  935. End;
  936.  
  937. (*--------------------------------------------------------------------------*)
  938. Procedure Do_Examine(Current : ContextType;InpStr : String);
  939. Var ObjNr : Integer;
  940.     Name  : String;
  941.     Flags : String;
  942. Begin
  943. If InpStr=''
  944.    Then exit;
  945. InpStr:=UpStr(InpStr);
  946. ObjNr:=Str2ObjNr(Current,InpStr);
  947. If ObjNr=NOTHING
  948.    Then ObjNr:=FussyStr2ObjNr(Current,InpStr);
  949. If ObjNr=NOTHING
  950.    Then Begin
  951.         My_WriteLn('You don''t see anything special.');
  952.         Exit;
  953.         End;
  954.  
  955. Current.DB.ReadObj(ObjNr);
  956. If Current.DB.ObjRec.Owner=NOTHING
  957.    Then Begin
  958.         My_WriteLn('Hmm, strange.. I can''t say who this belongs to..');
  959.         Exit;
  960.         End;
  961.  
  962. If (Current.DB.IsPlayer And
  963.    (ObjNr=Current.Player) And
  964.    (Not Current.DB.LevelOk(Builder_Level)))
  965.    Then Begin
  966.         Case Current.Gender Of
  967.          Female : My_WriteLn('After carefull examination you find out you are a girly!');
  968.          Male   : My_WriteLn('After carefull examination you find out you are a Boy!');
  969.          Neuter : Begin
  970.                   My_WriteLn('After carefull examination you find out you are something!');
  971.                   My_WriteLn('but you''re definitly not a boy nor a girly..');
  972.                   End;
  973.         End; {Case}
  974.         Exit;
  975.         End;
  976.  
  977. If (Current.DB.ObjRec.Location=Current.Room) or
  978.    (Current.DB.ObjRec.Location=Current.Player) or
  979.    (Current.Level>=Builder_Level)
  980.    Then Begin
  981.         Name:=Current.DB.Name;
  982.         Flags:='';
  983.         If Current.Db.IsTemple    Then Flags:=Flags+'Temple, ';
  984.         If Current.Db.IsHaven     Then Flags:=Flags+'Haven, ';
  985.         If Current.Db.IsShop      Then Flags:=Flags+'Shop, ';
  986.         If Current.Db.IsLinkOk    Then Flags:=Flags+'Linkable, ';
  987.         If Current.Db.IsInvisible Then Flags:=Flags+'Invisible, ';
  988.         If Current.DB.IsSticky    Then Flags:=Flags+'Sticky, ';
  989.         If Flags<>''
  990.            Then Begin
  991.                 Dec(Flags[0],2);
  992.                 Flags:='Flags: '+Flags+'.';
  993.                 End;
  994.         If Current.DB.IsForSale
  995.            Then My_WriteLn(Name+' is for sale.')
  996.            Else Begin
  997.                 Current.DB.ReadObj(Current.DB.ObjRec.Owner);
  998.                 My_WriteLn(Name+' (#'+Nr2Str(ObjNr)+') belongs to '+Current.DB.Name);
  999.                 My_WriteLn(Flags);
  1000.                 End;
  1001.         End
  1002.    Else Begin
  1003.         Name:=Current.DB.Name;
  1004.         Current.DB.ReadObj(Current.DB.ObjRec.Owner);
  1005.         My_WriteLn(Name+' (#'+Nr2Str(ObjNr)+') belongs to '+Current.DB.Name);
  1006.         End;
  1007.  
  1008. {If (Current.DB.ObjRec.Location=Current.Room) or
  1009.    (Current.DB.ObjRec.Location=Current.Player) or
  1010.    (Current.DB.LevelOk(Wizard_Level))
  1011.    Then Begin
  1012.         Name:=Current.DB.Name;
  1013.         Current.DB.ReadObj(Current.DB.ObjRec.Owner);
  1014.         My_WriteLn(Name+' (#'+Nr2Str(ObjNr)+') belongs to '+Current.DB.Name);
  1015.         End
  1016.    Else My_WriteLn('That object isn''t here..');}
  1017. End;
  1018.  
  1019. (*--------------------------------------------------------------------------*)
  1020. Procedure Do_Help(InpStr : String);
  1021. Var Help : Text;
  1022.     Line : String;
  1023.     Stop : Boolean;
  1024.     Buf  : Array[0..2047] of char;
  1025.     Name : String[8];
  1026.  
  1027. Begin
  1028. InpStr:=UpStr(CleanUp(InpStr));
  1029. If InpStr=''
  1030.    Then InpStr:='HELP';
  1031.  
  1032. If Not ExistFile(TextPath+'HELP.MUD')
  1033.    Then Assign(Help,HomeDir+'HELP.MUD')
  1034.    Else Assign(Help,TextPath+'HELP.MUD');
  1035. SetTextBuf(Help,Buf);
  1036. Reset(Help);
  1037. If IoResult<>0
  1038.    Then Begin
  1039.         My_WriteLn('Sorry, no help available. Use ? for a list of commands.');
  1040.         Exit;
  1041.         End;
  1042.  
  1043. Stop:=False;
  1044. Repeat
  1045.  ReadLn(Help,Line);
  1046.  If Not (Line[1] in [' ','.'])
  1047.     Then Stop:=Pos(InpStr,Line)=1;
  1048. until Eof(Help) Or Stop;
  1049. If Eof(Help)
  1050.    Then Begin
  1051.         Close(Help);
  1052.         My_WriteLn('No help available on that subject.');
  1053.         Exit;
  1054.         End;
  1055.  
  1056. My_WriteLn(Line);
  1057. ReadLn(Help,Line);
  1058. My_WriteLn(' Syntax: '+Line);
  1059. My_WriteLn(' Description:');
  1060. Repeat
  1061.  ReadLn(Help,Line);
  1062.  If Line[1]='.'
  1063.     Then My_WriteLn('')
  1064.     Else My_WriteLn(Line);
  1065. Until Eof(Help) Or (CleanUp(Line)='');
  1066. Close(Help);
  1067. If IoResult<>0   Then ;
  1068. End;
  1069.  
  1070. (*--------------------------------------------------------------------------*)
  1071. Procedure Do_Use(Current : ContextType;InpStr : String);
  1072. Var ObjNr  : Integer;
  1073.     Params : Array[1..9] of String[40];
  1074.     PStr   : String;
  1075.     PCnt   : Byte;
  1076.     PPtr   : Byte;
  1077.     Count  : Byte;
  1078. Begin
  1079. If InpStr=''
  1080.    Then Begin
  1081.         My_WriteLn('Syntax: USE <Object>');
  1082.         Exit;
  1083.         End;
  1084.  
  1085. If SplitCommand(InpStr,InpStr,PStr)
  1086.    Then Begin
  1087.         FillChar(Params,SizeOf(Params),#00);
  1088.         PCnt:=0;
  1089.         If PStr<>''
  1090.            Then Begin
  1091.                 Repeat
  1092.                   If Pos(';',PStr)>0
  1093.                      Then Begin
  1094.                           Inc(PCnt);
  1095.                           Params[PCnt]:=Copy(PStr,1,Pos(';',PStr)-1);
  1096.                           Delete(PStr,1,Length(Params[PCnt])+1);
  1097.                           End
  1098.                      Else Begin
  1099.                           Inc(PCnt);
  1100.                           Params[PCnt]:=PStr;
  1101.                           PStr:='';
  1102.                           End;
  1103.                 Until PStr='';
  1104.                 End;
  1105.         End;
  1106.  
  1107. ObjNr:=Str2ObjNr(Current,InpStr);
  1108. If ObjNr=NOTHING
  1109.    Then Begin
  1110.         My_WriteLn('You don''t have that object.');
  1111.         Exit;
  1112.         End;
  1113.  
  1114. Current.DB.ReadObj(ObjNr);
  1115. If (Current.DB.ObjRec.Macro.Length=0) Or
  1116.    (Not Expression(Current.DB.ObjRec.Key,Current))
  1117.    Then Begin
  1118.         My_WriteLn('Your powers are insufficient to use the object.');
  1119.         Exit;
  1120.         End;
  1121.  
  1122. MacroString:=Current.DB.Macro;
  1123. If MacroString[1]='='
  1124.    Then Begin
  1125.         If Str2Nr(MacroString[2])>PCnt
  1126.            Then Begin
  1127.                 Current.DB.Describe('You need at least '+MacroString[2]+' parameters');
  1128.                 MacroString:='';
  1129.                 Exit;
  1130.                 End;
  1131.         Delete(MacroString,1,Pos('^',MacroString));
  1132.         End;
  1133.  
  1134. For Count:=1 To PCnt Do
  1135.  Begin
  1136.  PPtr:=Pos('%'+Nr2Str(Count),MacroString);
  1137.  If PPtr>0
  1138.     Then Begin
  1139.          Delete(MacroString,PPtr,2);
  1140.          Insert(Params[Count],MacroString,PPtr);
  1141.          End;
  1142.  End;
  1143.  
  1144.  
  1145. End;
  1146.  
  1147. End.
  1148.  
  1149.